Is there anyway to call a method that is defined below. Its for updating purposes.
For example
Method 1
Creates another dialog box to allow editting and a button to update the edit.
Edits the attribute of the object.
-now, i want to first close the db in method 2 here, then call method 2 again so I can have a new db with the updated label
Method 2
Creates a dialog box with a label of the object attribute and a button to edit the label.
If button is clicked, it calls Method 1.
Anyway of calling a method that is defined below? Thanks!
phan423 - Thu Feb 16 16:06:49 EST 2012 |
|
Re: Call a method below llandale - Thu Feb 16 16:36:38 EST 2012
You can "Forward Declare". You specify the return parameter, the name of the function, and the TYPES of input parameters, without any labels:
string GetIt(string) // Forward declare
void DoIt()
{ print "DoIt: " (GetIt("Hello")) "\n" // calling function
}
string GetIt(string in_Value) // actual function
{ return(in_Value " goodbye")
}
DoIt()
There has been some issues with forward declare, including in Batchmode.
You can re-structure your code. Put the body of Method2 above Method1 and add a small routine Method2Driver at the bottom. Method2 defines the dialog, and both Method1 and Method2Driver call Method2 and also "show" the dialog. You would send the function "Method1" to Method2, but I forgot how to do that.
-Louie
|
|
Re: Call a method below phan423 - Thu Feb 16 16:42:46 EST 2012 llandale - Thu Feb 16 16:36:38 EST 2012
You can "Forward Declare". You specify the return parameter, the name of the function, and the TYPES of input parameters, without any labels:
string GetIt(string) // Forward declare
void DoIt()
{ print "DoIt: " (GetIt("Hello")) "\n" // calling function
}
string GetIt(string in_Value) // actual function
{ return(in_Value " goodbye")
}
DoIt()
There has been some issues with forward declare, including in Batchmode.
You can re-structure your code. Put the body of Method2 above Method1 and add a small routine Method2Driver at the bottom. Method2 defines the dialog, and both Method1 and Method2Driver call Method2 and also "show" the dialog. You would send the function "Method1" to Method2, but I forgot how to do that.
-Louie
Awesome! You're a genius! Worked like a charm. Thanks
|
|
Re: Call a method below SystemAdmin - Tue Feb 21 09:42:08 EST 2012 phan423 - Thu Feb 16 16:42:46 EST 2012
Awesome! You're a genius! Worked like a charm. Thanks
Just FYI - There used to be some limitations with forward declarations e.g. you could not do a forward declaration for a callback function attached to an apply button.
|
|
Re: Call a method below phan423 - Tue Feb 21 13:58:54 EST 2012 SystemAdmin - Tue Feb 21 09:42:08 EST 2012
Just FYI - There used to be some limitations with forward declarations e.g. you could not do a forward declaration for a callback function attached to an apply button.
Yes, I've come to realize that after playing with this. I limited my callbacks so I can only callback methods and not apply buttons
|
|
Re: Call a method below Mathias Mamsch - Wed Feb 22 11:44:35 EST 2012 phan423 - Tue Feb 21 13:58:54 EST 2012
Yes, I've come to realize that after playing with this. I limited my callbacks so I can only callback methods and not apply buttons
By the way, there is a (slightly more complicated) but more flexible way of handling a forward declaration problem, which I like to call virtual function. You can use it to define at runtime a function to call. This way, you can also 'switch/change' callback functions of buttons at runtime and stuff like this.
The pattern is described here:
https://www.ibm.com/developerworks/forums/click.jspa?searchID=-1&messageID=14684538
and here:
https://www.ibm.com/developerworks/forums/click.jspa?searchID=-1&messageID=14635624
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|